<head>
</head>
<body>
<html>

<h2>Perceptive Licensing Administration API Test Page</h2>

<table>
	<tr>
		<td>Host:</td>
		<td><input type='text' id='host' value='127.0.0.1' /></td>
	</tr>
	<tr>
		<td>Port:</td>
		<td><input type='text' id='port' value='8880' /></td>
	</tr>
	<tr>
		<td>Container:</td>
		<td><input type='text' id='container' value='NolijLicensing' />
		</td>
	</tr>
	<tr>
		<td>SSL:</td>
		<td><input type='checkbox' id='ssl' /></td>
	</tr>
</table>
<br />
<form name="loginform" method="POST" onSubmit="return onSubmitForm();"
	target="_blank">
	<LABEL for="username">Username: </LABEL> <INPUT type="text"
		name="j_username"><BR> <LABEL for="password">Password:
	</LABEL> <INPUT type="password" name="j_password"><BR> <input
		type="submit" name="mysubmit" value="Log in">

</form>

<script language="javascript">
	function getCookie(cookie_name) {
		var results = document.cookie.match('(^|;) ?' + cookie_name
				+ '=([^;]*)(;|$)');

		if (results)
			return (unescape(results[2]));
		else
			return null;
	}

	function setCookie(name, value) {
		var cookie_string = name + "=" + escape(value);

		var expires = new Date(9999, 09, 09);
		cookie_string += "; expires=" + expires.toGMTString();
		document.cookie = cookie_string;
	}

	function getHost() {
		if (document.getElementById("host").value == '') {
			document.getElementById("host").value = 'localhost';
		}
		setCookie("apitesthost", document.getElementById("host").value);
		return document.getElementById("host").value;
	}

	function getPort() {
		setCookie("apitestport", document.getElementById("port").value);
		return document.getElementById("port").value;
	}

	function getContainer() {
		setCookie("apitestcontainer",
				document.getElementById("container").value);
		return document.getElementById("container").value;
	}

	function getSSLString() {
		var sslString;
		if (document.getElementById("ssl").checked)
			sslString = "s";
		else
			sslString = "";
		setCookie("apitestssl", sslString);
		return sslString;
	}

	function getBaseUrl() {
		return 'http' + getSSLString() + '://' + getHost() + ':' + getPort()
				+ '/' + getContainer();
	}

	function onSubmitForm() {
		document.loginform.action = getBaseUrl() + '/j_spring_security_check';
		return true;
	}

	document.getElementById("host").value = getCookie("apitesthost");
	document.getElementById("port").value = getCookie("apitestport");
	document.getElementById("container").value = getCookie("apitestcontainer");
	document.getElementById("container").checked = (getCookie("apitestcontainer") == "s");
</script>
<hr />
<b>Get Clients</b>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetClients')">REST
	URL</a>
<br />
<hr />
<b>Get Products</b>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetProducts')">REST
	URL</a>
<br />
<hr />
<b>Get Client Products</b>
<table>
	<tr>
		<td>Client ID:</td>
		<td><input type='text' id='clientId' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetClientProducts?clientId=' + document.getElementById('clientId').value)">REST
	URL</a>
<br />
<hr />
<b>Get License Types By Product</b>
<table>
	<tr>
		<td>Product ID:</td>
		<td><input type='text' id='productId' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetLicenseTypesByProduct?productId=' + document.getElementById('productId').value)">REST
	URL</a>
<br />
<hr />
<b>Add Client</b>
<table>
	<tr>
		<td>Client Name:</td>
		<td><input type='text' id='clientName' value='' /></td>
		<td>Client Alias:</td>
		<td><input type='text' id='clientAlias' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/AddClient?name=' + document.getElementById('clientName').value + '&alias=' + document.getElementById('clientAlias').value)">REST
	URL</a>
<br />
<hr />
<b>Add Product to Client</b>
<table>
	<tr>
		<td>Client ID:</td>
		<td><input type='text' id='p2cClientId' value='' /></td>
		<td>Product ID:</td>
		<td><input type='text' id='p2cProductId' value='' /></td>
		<td>Max Licenses:</td>
		<td><input type='text' id='p2cMax' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/AddProductToClient?clientId=' + document.getElementById('p2cClientId').value + '&productId=' + document.getElementById('p2cProductId').value + '&max=' + document.getElementById('p2cMax').value)">REST
	URL</a>
<br />
<hr />
<b>Add License</b>
<table>
	<tr>
		<td>Client ID:</td>
		<td><input type='text' id='licClientId' value='' /></td>
		<td>Product ID:</td>
		<td><input type='text' id='licProductId' value='' /></td>
		<td>Description:</td>
		<td><input type='text' id='licDesc' value='' /></td>
		<td>License Type Key:</td>
		<td><input type='text' id='licTypeKey' value='' /></td>
		<td>Validation Type:</td>
		<td><select id="licValidation">
				<option value="Standard">Standard</option>
				<option value="Key">Key</option>
		</select>
		</td>
		<td>Date Expires:</td>
		<td><input type='text' id='licExpires' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/AddLicense?clientId=' + document.getElementById('licClientId').value + '&productId=' + document.getElementById('licProductId').value + '&desc=' + document.getElementById('licDesc').value + '&type=' + document.getElementById('licTypeKey').value + '&validation=' + document.getElementById('licValidation').value + '&dateExpires=' + document.getElementById('licExpires').value)">REST
	URL</a>
<br />
<hr />
<b>Generate License File</b>
<table>
	<tr>
		<td>License Key:</td>
		<td><input type='text' id='genLicId' value='' /></td>
	</tr>
</table>
<a href="#"
	onclick="javascript:window.open(getBaseUrl() + '/handler/licensing/api/GetLicenseFile?licenseId=' + document.getElementById('genLicId').value)">REST
	URL</a>
<br />
<hr />
</body>
</html>